#include "native_1/Export.h"
#include "Handle.h"


void LoadCmake()
{
    // Load With the CMake Shared link

    Script::BaseBehavior *res = GetBehavior_N1("Test.h");

    res->OnCreate();
    res->OnDestroy();
    res->OnStart();

    delete res;
};


void LoadShared()
{
    // Load native dll from the shared lib loader

    const std::string path = "native_1/libnative_1.so";
    Shared::Handle handle;
    handle.Open(path.c_str());

    typedef Script::BaseBehavior *Func(const std::string &);
    Func *func = handle.GetProcAddrAs<Func *>("GetBehavior_N1");

    Script::BaseBehavior *res = func("User.h");

    res->OnCreate();
    res->OnStart();
    res->OnDestroy();

    delete res;

    Script::BaseBehavior *test = func("Test.h");

    test->OnCreate();
    test->OnStart();
    test->OnDestroy();

    delete test;

    handle.Close();
};

int main()
{

    // LoadCmake();

    LoadShared();

    return 0;
}
